<template>
	<div class="seek_pop">
		<el-dialog
			title="审查处方信息"
			:visible.sync="dialogVisible"
			width="90%">
			<div class="end_time">
				倒计时：<span>53</span>
			</div>
			<div class="seek_form clear">
				<div class="seek_factor fl">
					<span class="seek_text" title="门/急/住院号">门/急/住院号</span>
					<span class="seek_val" :title="info.mz_jz_zyh">{{info.mz_jz_zyh}}</span>
				</div>
				<div class="seek_factor fl">
					<span class="seek_text" title="科室名称">科室名称</span>
					<span class="seek_val" :title="info.deptName">{{info.deptName}}</span>
				</div>
				<div class="seek_factor fl">
					<span class="seek_text" title="医保病人">医保病人</span>
					<span class="seek_val" :title="info.ybbr">{{info.ybbr}}</span>
				</div>
				<div class="seek_factor fl">
					<span class="seek_text" title="病人姓名">病人姓名</span>
					<span class="seek_val" :title="info.patientName">{{info.patientName}}</span>
				</div>
				<div class="seek_factor fl">
					<span class="seek_text" title="性别">性别</span>
					<span class="seek_val" :title="info.sex">{{info.sex}}</span>
				</div>
				<div class="seek_factor fl">
					<span class="seek_text" title="年龄">年龄</span>
					<span class="seek_val" :title="info.age">{{info.age}}</span>
				</div>
				<div class="seek_factor fl">
					<span class="seek_text" title="身高/体重">身高/体重</span>
					<span class="seek_val" :title="info.height+'cm/'+info.weight+'kg'">{{info.height}}cm/{{info.weight}}kg</span>
				</div>
				<div class="seek_factor fl">
					<span class="seek_text" title="医生名称">医生名称</span>
					<span class="seek_val" :title="info.doctorCode">胡迪</span>
				</div>
				<div class="seek_factor fl">
					<span class="seek_text" title="医生编号">医生编号</span>
					<span class="seek_val" :title="info.doctorCode">{{info.doctorCode}}</span>
				</div>
				<div class="seek_factor fl">
					<span class="seek_text" title="医生编号">医生理由</span>
					<span class="seek_val" :title="info.doctorCode">22</span>
				</div>	
			</div>
			<div class="cf_textarea clear">
				<div class="cf_title fl">处方意见</div>
				<div class="cf_box fl">
					<textarea class="cf_input" ></textarea>
				</div>
				<div class="fl cf_btn">
					<el-button type="success" size="small">审核通过</el-button>
					<el-button type="danger" size="small">审核不通过</el-button>
					<el-button type="primary" size="small">双签复审</el-button>
				</div>
			</div>
			<el-tabs v-model="activeName" @tab-click="handleClick" class="seek_tabs">
			    <el-tab-pane :label="'审查结果（'+examList.length+'）'" name="scjg">
					<div class="xx_box" v-for="(item,index) in examList">
						<div class="xx_titbox">
							<div class="xx_title">{{index+1}}、{{item.title}}</div>
							<div class="xx_btn" v-if="item.abstractDesc!=''" @click="examChange(item)">[{{item.flag?'隐藏':'详细'}}]</div>
						</div>
						<div class="xx_cont">
							<div class="xx_contl" v-html="item.slCode_txt"></div>
							<div class="xx_contr" v-html="item.warning"></div>
						</div>
						<div class="xx_conb" v-if="item.flag" v-html="item.abstractDesc"></div>
					</div>
				</el-tab-pane>
			    <el-tab-pane :label="'用药信息（'+ordersList.length+'）'" name="yyxx">
					<Bluetable :tHead="ordersHead" :tData="ordersList"></Bluetable>
				</el-tab-pane>
			    <el-tab-pane :label="'诊断信息（'+diseaseList.length+'）'" name="zdxx">
					<Bluetable :tHead="diseaseHead" :tData="diseaseList"></Bluetable>
				</el-tab-pane>
			    <el-tab-pane :label="'过敏源信息（'+allergensList.length+'）'" name="gmyxx">
					<Bluetable :tHead="allergensHead" :tData="allergensList"></Bluetable>
				</el-tab-pane>
				<el-tab-pane :label="'审核历史（'+examHistoryList.length+'）'" name="shls">
					<Bluetable :tHead="examHistoryHead" :tData="examHistoryList" @clickFun="clickFun"></Bluetable>
					
				</el-tab-pane>
			</el-tabs>
		</el-dialog>
	</div>
</template>

<script>
	import {ptc} from "@/api/systemport.js";
	export default {
		name:"Queryseekpop",
		props:{
			seekRow : {
				type:Object
			},
			type:{
				type:String
			}
		},
		watch :{
			seekRow () {
				this.getInfo(this.seekRow.id)
			}
		},
		mounted(){

		},
		data () {
			return {
				dialogVisible:false,
				activeName:"scjg",
				info:{
					mz_jz_zyh:"123456",
					deptName:"胸痛门诊",
					lsh_num:"",
					patientName:"张三",
					sexFlag:"",
					sex:"男",
					age:"29岁",
					height:"170",
					weight:"65",
					is_brqflag:"",
					is_rsflag:"",
					rs_start_time:"",
					ybbr:"",
					jun_ren:"",
					gz_tagflag:"",
					sz_tagflag:"",
					doctorName:"",
					doctorCode:"6553"
				},
				examList:[
					{
						title:"重点关注疾病",
						slCode_txt:'<span class="point">重点关注</span>',
						warning:'本院自设审查<br>伤寒杆菌性败血症为重点关注疾病',
						abstractDesc:"",
						flag:false
					},
					{
						title:"★(甲)▲(塑瓶)氯化钾针",
						slCode_txt:'<span class="jinji">禁忌</span>',
						warning:'★(甲)▲(塑瓶)氯化钾针禁止静推。',
						abstractDesc:'<div class="dtlCt">【<b>摘要信息</b>】<br>&nbsp;&nbsp;&nbsp;&nbsp;本药不得直接静脉注射。<br>【<b>参考文献</b>】<br>&nbsp;&nbsp;&nbsp;&nbsp;1.氯化钾注射液说明书(中国大冢制药有限公司)</div>',
						flag:false
					},
				],
				ordersHead:[
					{
						label:"成组",
						prop:"tag_txt"
					},
					{
						label:"临时",
						prop:"isTempDrug_txt"
					},
					{
						label:"药品名称",
						prop:"drugName"
					},
					{
						label:"给药途径",
						prop:"routeName"
					},
					{
						label:"每次用量",
						prop:"liang_ciGydw"
					},
					{
						label:"频次",
						prop:"pinci"
					}
				],
				ordersList:[
					{
						tag_txt:"",
						isTempDrug_txt:"临时",
						drugName:"★(甲)▲(塑瓶)氯化钾针",
						routeName:"静推",
						liang_ciGydw:"1瓶",
						pinci:"BID1"
					}
				],
				diseaseHead:[
					{
						label:"诊断编码",
						prop:"disCode"
					},
					{
						label:"诊断名称",
						prop:"disName"
					}
				],
				diseaseList:[
					{
						disCode:"A01.001",
						disName:"伤寒"
					},
					{
						disCode:"A01.002",
						disName:"伤寒杆菌性败血症"
					},
					{
						disCode:"A01.003",
						disName:"伤寒性脑膜炎"
					}
				],
				allergensHead:[
					{
						label:"过敏源编码",
						prop:"allerCode"
					},
					{
						label:"过敏源名称",
						prop:"allerName"
					}
				],
				allergensList:[
					{
						allerCode:"2%碘酊",
						allerName:"2%碘酊"
					},
					{
						allerCode:"5%碘酊",
						allerName:"5%碘酊"
					},
					{
						allerCode:"苄星青霉素注射剂",
						allerName:"苄星青霉素注射剂"
					},
					{
						allerCode:"丙泊酚注射液",
						allerName:"丙泊酚注射液"
					}
				],
				examHistoryHead:[
					{
						// label:"版本信息",
						// prop:"banbenflag",
						// click:true
					},
					{
						label:"操作时间",
						prop:"exam_time"
					},
					{
						label:"审核状态",
						prop:"statuss"
					},
					{
						label:"药师意见/医生执行原因",
						prop:"exam_remark"
					}
				],
				examHistoryList:[
					{
						exam_time:"2020-05-17 12:00:16",
						statuss:"新处方待进入药师审核平台[系统审查有问题]",
						exam_remark:""
					},
					{
						exam_time:"2020-05-17 12:00:16",
						statuss:"新处方待进入药师审核平台[胡迪]",
						exam_remark:""
					},
					{
						exam_time:"2020-05-17 12:00:15",
						statuss:"新处方待进入药师审核平台[系统审查有问题]",
						exam_remark:""
					},
					{
						exam_time:"2020-05-17 12:00:14",
						statuss:"新处方待进入药师审核平台[胡迪]",
						exam_remark:""
					},
					{
						exam_time:"2020-05-17 12:00:09",
						statuss:"新处方待进入药师审核平台[系统审查有问题]",
						exam_remark:""
					}
				],
			}
		},
		methods: {
			examChange(item){
				item.flag=!item.flag;
			},
			handleClick(tab, event) {
				// console.log(tab, event);
			},
			show(){
				this.dialogVisible = true
			},
			async getInfo (patInfoId) {
				let res = await this.$ptc.pharOrderDefaultSeek({
					patInfoId:patInfoId,
					type:this.type
				})
				this.info=res.patInfo;
				this.info.sexflag=res.sex;
				this.info.age=res.age;
				this.info.is_brqflag=res.is_brq==1?"是":"否";
				this.info.is_rsflag=res.is_rs==1?"是":"否";
				this.info.gz_tagflag=res.gz_tag==1?"轻度":(res.gz_tag==2?"中度":"重度");
				this.info.sz_tagflag=res.sz_tag==1?"轻度":(res.sz_tag==2?"中度":"重度");
				let http=process.env.VUE_APP_BASE_API+":"+ptc;
				for(var i=0;i<res.examList.length;i++){
					res.examList[i].abstractDesc="<div style='padding:15px 6px;'>"+res.examList[i].abstractDesc+"</div>"
				}
				this.examList=res.examList;
				for(var i=0;i<res.ordersList.length;i++){
					res.ordersList[i].tag_txt=res.ordersList[i].tag_txt?("<img src='"+http+res.ordersList[i].tag_txt+"'>"):"";
					res.ordersList[i].liang_ciGydw=res.ordersList[i].liang_ci+res.ordersList[i].gydw;
				}
				this.ordersList=res.ordersList;
				this.diseaseList=res.diseaseList;
				this.allergensList=res.allergensList;
				for(var i=0;i<res.examHistoryList.length;i++){
					res.examHistoryList[i].exam_time=this.$utils.timeFormat(res.examHistoryList[i].exam_time);
					res.examHistoryList[i].statuss=res.examHistoryList[i].phar_state_txt+"["+res.examHistoryList[i].phar_cnname+"]";
					res.examHistoryList[i].banbenflag=res.examHistoryList[i].banben?("<span style='color:#409EFF;cursor:pointer;'>"+res.examHistoryList[i].banben+"</span>"):"";
					
				}
				this.examHistoryList=res.examHistoryList;
			},
			clickFun(row){
				this.$emit("clickFun",row);
			}
		}
	}
</script>

<style lang="scss" scoped="scoped">
	.xx_box{
		border-bottom:1px solid #CDBA96;
		&:last-child{
			border-bottom:0;
		}
		.xx_titbox{
			overflow:hidden;line-height:180%;margin-top:5px;
			.xx_title{
				float:left;font-weight:bold;color:#219618;
			}
			.xx_btn{
				float:right;color:#333;cursor:pointer;
			}
		}
		.xx_cont{
			padding-bottom:10px;overflow:hidden;line-height:1.5;
			.xx_contl{
				float:left;width:60px;
			}
			.xx_contr{
				float:left;
			}
		}
	}
	.seek_pop{
		padding:0 20px;
		.cf_textarea{
			widh:100px;
			line-height:40px;
			color:#333;
			font-size:14px;
			margin-top:20px;
			button{
				display:block;
				margin:5px 0 10px 0;
			}
			.cf_title{
				width:11.25%;
				text-align:right;
				padding-right:10px;
			}
			.cf_box{
				width:70%;
				textarea{
					display:block;
					width:100%;
					height:150px;
					border:1px solid #ededed;
					resize:none;
				}
			}
			.cf_btn{
				padding-left:20px;
			}
		}
		.end_time{
			width:100%;
			height:40px;
			line-height:40px;
			text-align:right;
			font-size:16px;
			color:#333;
			span{
				color:red;
			}
		}
		.seek_form{
			font-size:14px;
			line-height:40px;
			border:1px solid #b3d8ff;
			.seek_factor{
				width:25%;
				height:40px;
				display:flex;align-items: center;justify-content: center;
				.seek_text{
					display:inline-block;
					width:45%;
					height:100%;
					background:#ecf5ff;
					color:#409eff;
					text-align:right;
					padding-right:10px;
					overflow: hidden;
					text-overflow:ellipsis;
					white-space: nowrap;
				}
				.seek_val{
					display:inline-block;
					width:55%;
					height:100%;
					color:#333;
					padding-left:10px;
					overflow: hidden;
					text-overflow:ellipsis;
					white-space: nowrap;
				}
			}
		}
		.seek_tabs{
			margin-bottom:20px;
		}
	}
</style>
